From b954000d88ddb6fe6fcfa831715d010cb52dd8b2 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Tue, 8 Jul 2025 13:32:21 +0200 Subject: [PATCH] Export symbols needed by binder Bug-Debian: https://bugs.debian.org/901492 We want to enable use of the Android binder driver to support Waydroid, but it should not be built-in as that would waste resources and increase security attack surface on systems that don't need it. Export the currently un-exported symbols it depends on. Gbp-Pq: Topic debian Gbp-Pq: Name export-symbols-needed-by-binder.patch --- fs/file.c | 1 + ipc/msgutil.c | 1 + ipc/namespace.c | 1 + kernel/sched/syscalls.c | 1 + kernel/sched/wait.c | 1 + kernel/task_work.c | 1 + mm/list_lru.c | 2 ++ mm/memory.c | 1 + mm/mmap_lock.c | 1 + security/security.c | 4 ++++ 10 files changed, 14 insertions(+) diff --git a/fs/file.c b/fs/file.c index 0a4f3bdb2de..1a53e547408 100644 --- a/fs/file.c +++ b/fs/file.c @@ -881,6 +881,7 @@ struct file *file_close_fd(unsigned int fd) return file; } +EXPORT_SYMBOL_GPL(file_close_fd); void do_close_on_exec(struct files_struct *files) { diff --git a/ipc/msgutil.c b/ipc/msgutil.c index e28f0cecb2e..89a8fae5d90 100644 --- a/ipc/msgutil.c +++ b/ipc/msgutil.c @@ -35,6 +35,7 @@ struct msg_msgseg { struct msg_msgseg *next; /* the next part of the message follows immediately */ }; +EXPORT_SYMBOL_GPL(init_ipc_ns); #define DATALEN_MSG ((size_t)PAGE_SIZE-sizeof(struct msg_msg)) #define DATALEN_SEG ((size_t)PAGE_SIZE-sizeof(struct msg_msgseg)) diff --git a/ipc/namespace.c b/ipc/namespace.c index 535f16ea40e..47e7af1b1ec 100644 --- a/ipc/namespace.c +++ b/ipc/namespace.c @@ -210,6 +210,7 @@ void put_ipc_ns(struct ipc_namespace *ns) schedule_work(&free_ipc_work); } } +EXPORT_SYMBOL_GPL(put_ipc_ns); static struct ns_common *ipcns_get(struct task_struct *task) { diff --git a/kernel/sched/syscalls.c b/kernel/sched/syscalls.c index 6f10db3646e..14cb3de510e 100644 --- a/kernel/sched/syscalls.c +++ b/kernel/sched/syscalls.c @@ -119,6 +119,7 @@ int can_nice(const struct task_struct *p, const int nice) { return is_nice_reduction(p, nice) || capable(CAP_SYS_NICE); } +EXPORT_SYMBOL_GPL(can_nice); #ifdef __ARCH_WANT_SYS_NICE diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index 20f27e2cf7a..8b1338c2834 100644 --- a/kernel/sched/wait.c +++ b/kernel/sched/wait.c @@ -231,6 +231,7 @@ void __wake_up_pollfree(struct wait_queue_head *wq_head) /* POLLFREE must have cleared the queue. */ WARN_ON_ONCE(waitqueue_active(wq_head)); } +EXPORT_SYMBOL_GPL(__wake_up_pollfree); /* * Note: we use "set_current_state()" _after_ the wait-queue add, diff --git a/kernel/task_work.c b/kernel/task_work.c index 0f7519f8e7c..45fd146b85d 100644 --- a/kernel/task_work.c +++ b/kernel/task_work.c @@ -102,6 +102,7 @@ int task_work_add(struct task_struct *task, struct callback_head *work, return 0; } +EXPORT_SYMBOL_GPL(task_work_add); /** * task_work_cancel_match - cancel a pending work added by task_work_add() diff --git a/mm/list_lru.c b/mm/list_lru.c index ec48b5dadf5..bf95d73c981 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -179,6 +179,7 @@ bool list_lru_add(struct list_lru *lru, struct list_head *item, int nid, unlock_list_lru(l, false); return false; } +EXPORT_SYMBOL_GPL(list_lru_add); bool list_lru_add_obj(struct list_lru *lru, struct list_head *item) { @@ -216,6 +217,7 @@ bool list_lru_del(struct list_lru *lru, struct list_head *item, int nid, unlock_list_lru(l, false); return false; } +EXPORT_SYMBOL_GPL(list_lru_del); bool list_lru_del_obj(struct list_lru *lru, struct list_head *item) { diff --git a/mm/memory.c b/mm/memory.c index da360a6eb8a..345f21c3747 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2168,6 +2168,7 @@ void zap_page_range_single(struct vm_area_struct *vma, unsigned long address, zap_page_range_single_batched(&tlb, vma, address, size, details); tlb_finish_mmu(&tlb); } +EXPORT_SYMBOL_GPL(zap_page_range_single); /** * zap_vma_ptes - remove ptes mapping the vma diff --git a/mm/mmap_lock.c b/mm/mmap_lock.c index 7421b7ea800..850527b4462 100644 --- a/mm/mmap_lock.c +++ b/mm/mmap_lock.c @@ -380,6 +380,7 @@ fallback: return vma; } +EXPORT_SYMBOL_GPL(lock_vma_under_rcu); #endif /* CONFIG_PER_VMA_LOCK */ #ifdef CONFIG_LOCK_MM_AND_FIND_VMA diff --git a/security/security.c b/security/security.c index 31a68865060..b4776f0e25b 100644 --- a/security/security.c +++ b/security/security.c @@ -488,6 +488,7 @@ int security_binder_set_context_mgr(const struct cred *mgr) { return call_int_hook(binder_set_context_mgr, mgr); } +EXPORT_SYMBOL_GPL(security_binder_set_context_mgr); /** * security_binder_transaction() - Check if a binder transaction is allowed @@ -503,6 +504,7 @@ int security_binder_transaction(const struct cred *from, { return call_int_hook(binder_transaction, from, to); } +EXPORT_SYMBOL_GPL(security_binder_transaction); /** * security_binder_transfer_binder() - Check if a binder transfer is allowed @@ -518,6 +520,7 @@ int security_binder_transfer_binder(const struct cred *from, { return call_int_hook(binder_transfer_binder, from, to); } +EXPORT_SYMBOL_GPL(security_binder_transfer_binder); /** * security_binder_transfer_file() - Check if a binder file xfer is allowed @@ -534,6 +537,7 @@ int security_binder_transfer_file(const struct cred *from, { return call_int_hook(binder_transfer_file, from, to, file); } +EXPORT_SYMBOL_GPL(security_binder_transfer_file); /** * security_ptrace_access_check() - Check if tracing is allowed -- 2.30.2